<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>添加人员</title>
     <link href="CSS/Accessible_Design.css" rel="stylesheet" type="text/css" />
		<style type="text/css">
	<!--
	.STYLE1 {
		color: #000066;
		font-weight: bold;
		font-size: large;
	}
	-->
	</style>
	
		<script type='text/javascript' src='dwr/engine.js'> </script>
		<script type='text/javascript' src='dwr/util.js'> </script>
		<script type='text/javascript' src='dwr/interface/DwrSelectClassByCollegeId.js'> </script>
		<script type="text/javascript">
		function selectClass(){
			var collegeId=document.getElementById("college").value;
			DwrSelectClassByCollegeId.selcetClassByCollegeId(collegeId,getName);
		}
		function getName(name)
		{
		   //获得class这个下拉列表组件
		  	var classes=document.getElementById("classes");
		
			//删除这个下拉列表里所有选项
			for (var j = classes.options.length - 1; j >= 0; j--) {
	            classes.options.remove(j);
	        }
	        //往这个下拉列表里添加选项，内容是从dwr得到的值
			for(var i = 0;i < name.length;i++)
			{
			    classes.options.add(new Option(name[i].className,name[i].classId));
			}
		}
         </script>
  </head>
  
  <body>
  <html:form action="menberAdd.do">
   <table width="323" height="123" border="1" cellspacing="0" class="small">
  <tr>
    <td height="30" colspan="2"><div align="center" class="STYLE1">添加成员</div></td>
  </tr>
  <tr>
    <td width="93">账户名</td>
    <td width="214"><label>
      <html:text property="userAccount"/>
    </label></td>
  </tr>
    <tr>
    <td width="93">用户姓名</td>
    <td width="214"><label>
      <html:text property="userName"/>
    </label></td>
  </tr>
  <tr>
    <td>密码</td>
    <td><label>
    <html:text property="userpwd"/>
    </label></td>
  </tr>
  <tr>
    <td height="5">角色</td>
    <td height="5">
    
    <html:select property="role">
    <c:forEach items="${roleList}" var="role">
    	<html:option value="${role.roleId}">${role.roleName}</html:option>
    </c:forEach>
    </html:select>
    </td>
  </tr>
  <tr>
    <td height="2">学院</td>
    <td height="2">
     <html:select property="college" styleId="college" onchange="selectClass();">
     <html:option value="-1">-选择学院-</html:option>
     <c:forEach items="${listCollege}" var="colleges">
    	<html:option value="${colleges.collegeId}">${colleges.colName}</html:option>
     </c:forEach>
    </html:select>
    </td>
   </tr>
   <tr>    <td height="1">班级</td>
    <td height="1">
      <html:select property="classes" styleId="classes">
      <html:option value="-1">-选择班级-</html:option>
     <c:forEach items="${classList}" var="classes">
    	<html:option value="${classes.classId}">${classes.className}</html:option>
     </c:forEach>
     </html:select>
	  </td>
  </tr>
  <tr>
    <td height="2" colspan="2"><input type="submit" name="Submit" value="添加" /></td>
  </tr>
  </table>
  </html:form>
  </body>
</html>
